package com.ruoyi.supervise.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.supervise.domain.BaseConsturctionCertInfo;
import com.ruoyi.supervise.domain.ConsturctionCertChangeInfo;
import com.ruoyi.supervise.mapper.BaseConsturctionCertInfoMapper;
import com.ruoyi.supervise.service.IBaseConsturctionCertInfoService;
import com.ruoyi.supervise.util.XmlReadUtil;

/**
 * @ClassName: BaseConsturctionCertInfoServiceImpl
 * @Description: 施工许可证书表ConsturctionCertInfo的impl
 * @Author wtj
 * @DateTime 2020年4月14日 下午5:06:51
 */
@Service
@DataSource(value = DataSourceType.SLAVE)
public class BaseConsturctionCertInfoServiceImpl implements IBaseConsturctionCertInfoService 
{
    @Autowired
    private BaseConsturctionCertInfoMapper baseConsturctionCertInfoMapper;

	@Override
	public BaseConsturctionCertInfo selectConsturctionCertInfoByGuid(String guid) {
		BaseConsturctionCertInfo bcci = baseConsturctionCertInfoMapper.selectConsturctionCertInfoByGuid(guid);
		if(bcci != null && !StringUtils.isEmpty(bcci.getConsturctionChangeInfoList())) {
			ConsturctionCertChangeInfo ccci = new ConsturctionCertChangeInfo();
			ccci.setContent("Content");
			ccci.setModifiedPersonLoginName("ModifiedPersonLoginName");
			ccci.setModifiedPersonRealName("ModifiedPersonRealName");
			ccci.setPubDate("PubDate");
			ccci.setUnitName("UnitName");
			String nodePath = "/PsDataPacket/FDataList/ConsturctionChangeInfo";
			List<ConsturctionCertChangeInfo> ccciList = XmlReadUtil.getConsturctionCertChangeInfoXml(bcci.getConsturctionChangeInfoList(), nodePath, ccci);
			bcci.setConsturctionCertChangeInfoList(ccciList);
		}
		return bcci;
	}

}
